﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using FCT551.ViewModels;

namespace FCT551.Views
{
    /// <summary>
    /// UserLoginView.xaml 的交互逻辑
    /// </summary>
    public partial class UserLoginView : Window
    {
        public UserLoginView(string name, string password)
        {
            InitializeComponent();
            this.DataContext = new UserLoginViewModel(this, name, password);
            myPasswordBox.PasswordChanged += (s, e) =>
            {
                var vm = DataContext as UserLoginViewModel;
                vm.UserPassword = myPasswordBox.Password;
            };
        }

        /// <summary>
        /// 移动窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1 && e.LeftButton == MouseButtonState.Pressed)
            {
                DragMove();
            }
        }
    }
}